package com.ruoyi.driver.enums;

/**
 * @author lipengze
 * @version 1.0
 * @description: TODO
 * @date 2024/10/21 20:08
 */
public enum IdCardStatusEnum {
    FRONT(1, "身份证正面（人像面）"),
    BACK(2, "身份证反面（国徽面）");

    private final Integer code;
    private final String description;

    // 构造函数
    IdCardStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    // 获取枚举对应的代码值
    public Integer getCode() {
        return code;
    }

    // 获取枚举对应的描述
    public String getDescription() {
        return description;
    }

    // 根据 code 获取枚举
    public static IdCardStatusEnum fromDetail(Integer code) {
        for (IdCardStatusEnum status : IdCardStatusEnum.values()) {
            if (status.getCode()==code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid code for IdCardSide: " + code);
    }
}
